<?php echo $javascript->link('scriptaculous-js-1.8.3/lib/prototype.js'); ?>
<?php echo $javascript->link('scriptaculous-js-1.8.3/src/scriptaculous.js'); ?>
<div class="cancelledswaps index">
	<h2><?php __('Cancelledswaps');?></h2>
	<table cellpadding="0" cellspacing="0" width="100%">
	<tr>
			<th>Run ID</th>
			<th>Old CPE / Mac</th>
			<th>Account</th>
			<th>Detail Number</th>
			<th>X_TO</th>
			<th>X_FROM</th>
			<th>X_TODATE</th>
			<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
	$counter = 0;
	$i = 0;
	foreach ($results as $cancelledswap):
		$class = null;
		if ($i++ % 2 == 0) { $class = ' class="altrow"'; }
		else { $class = ' class="altrow2"'; }
	$div = "field".$counter;
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $cancelledswap['Runhasmac']['run_id']; ?>&nbsp;</td>
		<td><?php echo $cancelledswap['Mac']['mac']; ?>&nbsp;</td>
		<td><?php echo $cancelledswap['Customer']['account_number']; ?></td>
		<td><?php echo $cancelledswap['Partrequest']['detailnumber']; ?></td>
		<td><?php echo $cancelledswap['Partrequest']['xto']; ?></td>
		<td><?php echo $cancelledswap['Partrequest']['xfrom']; ?></td>
		<td><?php echo $cancelledswap['Partrequest']['xtodate']; ?></td>
		<td><div id="<?php echo $div; ?>" name = "<?php echo $div; ?>">
		  <?php echo $ajax->link('New Swap PR', array('controller' => 'cancelledswaps', 'action' => 'solve', '?' => array('cid' => $cancelledswap['Cancelledswap']['id'], 'macid' => $cancelledswap['Mac']['id'], 'runid' => $cancelledswap['Runhasmac']['run_id'], 'div' => $div)), array('update' => $div));
		  echo " - "; 
		  echo $ajax->link('New CPE installed', array('controller' => 'cancelledswaps', 'action' => 'skip', '?' => array('cid' => $cancelledswap['Cancelledswap']['id'], 'macid' => $cancelledswap['Mac']['id'], 'runid' => $cancelledswap['Runhasmac']['run_id'], 'div' => $div)), array('update' => $div));
		  echo " - "; 
		  echo $ajax->link('Old CPE remains', array('controller' => 'cancelledswaps', 'action' => 'cancel', '?' => array('cid' => $cancelledswap['Cancelledswap']['id'], 'macid' => $cancelledswap['Mac']['id'], 'runid' => $cancelledswap['Runhasmac']['run_id'], 'div' => $div)), array('update' => $div));
		  ?>
		</td>
	</tr>
	<?php $counter++; ?>
<?php endforeach; ?>
	</table>
</div>